package fr.insee.rome.string.norm;

import java.util.List;
import java.util.Set;

import fr.insee.rome.factory.RomeFactory;

public class SimpleNormalizer implements RomeNormalizer {

	private RomeNormalizationSteps normalization = null;
	private static RomeNormalizer instance = null;
	
	private SimpleNormalizer(){
		this.normalization = RomeFactory.getNormalizationSteps();
	}
	
	public static RomeNormalizer getInstance(){
		if(instance == null){
			instance = new SimpleNormalizer();
		}
		return instance;
	}
	
	public Set<String> normaliser(String x) {
		
		String y = normalization.supprimerCaracteresSpeciaux(x);
		y = normalization.mettreEnMajuscule(y);
		y = normalization.remplacerLesSynonymes(y);
		List<String> mots = normalization.separerMots(y);
		mots = normalization.supprimerMotsCourts(mots);	
		return normalization.supprimerMotsEnDouble(mots);
	}

}
